﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reactive.Disposables;
using CompositionalAudio;

namespace CompositionalAudio
{
    public class CompositionalAudio:IDisposable
    {
        private IStereoSource sigSource;
        CompositeDisposable compDisp = new CompositeDisposable();

        public IStereoSource Source { get; set; }
        public IPlayer Output { get; set; }

        public void Connect<T>(IObservable<T> observable, IObserver<T> observer)
        {
            compDisp.Add(observable.Subscribe(observer));
        }

        public void Dispose()
        {
            if (Output!=null)
                Output.Dispose();
            if (Source!=null)
                Source.Dispose();

            compDisp.Clear();
        }
    }
}
